home *** CD-ROM | disk | FTP | other *** search
- Path: monkeys.com!not-for-mail
- From: rfg@monkeys.com (Ronald F. Guilmette)
- Newsgroups: comp.lang.c,comp.lang.c++,gnu.gcc.help,gnu.g++.help,comp.os.msdos.djgpp
- Subject: Re: float != float and floats as return types
- Date: 15 Feb 1996 01:23:58 -0800
- Organization: Infinite Monkeys & Co.
- Message-ID: <4fuu3e$6c9@segfault.monkeys.com>
- References: <4ej9lb$mpc@fu-berlin.de> <4eqc7l$ugh@godzilla.zeta.org.au> <4eqtu3$ddo@der.twinsun.com> <TANMOY.96Feb1164022@qcd.lanl.gov>
- NNTP-Posting-Host: segfault.monkeys.com
-
- In article <TANMOY.96Feb1164022@qcd.lanl.gov>,
- Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov> wrote:
- >In article <4eqtu3$ddo@der.twinsun.com> eggert@twinsun.com (Paul
- >Eggert) writes:
- ><snip>
- > bde@zeta.org.au (Bruce Evans) writes:
- >
- > > a = 1.0;
- > > b = FLT_EPSILON / 4.0;
- > > c = a + b;
- > > assert(c == (float) (a + b));
- >
- > As far as I can tell the C Standard allows the assertion to either
- > succeed or fail, depending on the implementation. The key phrase in
- > the standard is ``The values of floating operands and of the results of
- > floating expressions may be represented in greater precision and range
- > than that required by the type''. So `c' might be represented in more
- > bits than `(float) (a + b)' (or vice versa! though this is more
- > controversial since it contradicts the Rationale, and it may be
- > corrected by the committee soon), and the assertion might fail.
- >
- >I do not agree with this interpretation, as the footnote (technically,
- >not part of the standard) clarifies: an assignment and cast both must
- >truncate the result to the required precision...
-
- As must the act of returning a result from a function... according to the
- official response to one Defect Report which was filed against the standard.
-
- --
-
- -- Ron Guilmette, Roseville, CA -------- Infinite Monkeys & Co. ------------
- ---- E-mail: rfg@monkeys.com ----------- Purveyors of Compiler Test Suites -
- ------ Copyright (c) 1996 by Ronald F. Guilmette; All rights reserved. -----
-